import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import functions as F

# 加载图片
img2 = mpimg.imread('true_results.png')
img1 = mpimg.imread('without_bayes.png')
img3 = mpimg.imread('with_bayes.png')

# 创建1行3列的子图
fig, axes = plt.subplots(1, 3, figsize=(15, 5))

# 显示图片
axes[0].imshow(img1)
axes[0].axis('off')  # 不显示坐标轴
axes[0].set_title('优化前')

axes[1].imshow(img2)
axes[1].axis('off')
axes[1].set_title('真实情况')

axes[2].imshow(img3)
axes[2].axis('off')
axes[2].set_title('优化后')

# 调整子图间距
plt.rcParams['font.sans-serif'] = ['SimHei']  # 设置字体为SimHei
plt.rcParams['axes.unicode_minus'] = False  # 解决负号显示为方块的问题
plt.tight_layout()
plt.show()

print('若以真实情况准确率为100%:')
print('\n优化前小组赛准确率:' + str(round(F.match_accuracy(5, 16), 3)) + '%   '
      + '优化前淘汰赛准确率:' + str(round(F.match_accuracy(9, 16), 3)) + '%')  # 68.75% 43.75%

print('\n优化后小组赛准确率:' + str(round(F.match_accuracy(4, 16), 3)) + '%   '
      + '优化后淘汰赛准确率:' + str(round(F.match_accuracy(3, 16), 3)) + '%')  # 75.0% 68.75%
